package com.partner.partnerback.common.enums;

import lombok.Getter;

@Getter
public enum EmailCodeEnum {

    REGISTER("REGISTER", "register:"),
    RESET_PASSWORD("RESETPASSWORD","resetPassword:"),
    LOGIN("LOGIN","login:"),
    CHANGE_PASSWORD("CHANGEPASSWORD","changePassword:"),
    UNKNOWN("","");

    private final String type;
    private final String value;

    EmailCodeEnum(String type, String value){
        this.type = type;
        this.value = value;
    }

    public static String getValue(String type){
        EmailCodeEnum[] values = values();
        for (EmailCodeEnum value: values){
            if (type.equals(value.type)){
                return value.value;
            }
        }
        return "";
    }

    public static EmailCodeEnum getEnum(String type){
        EmailCodeEnum[] codeEnums = values();
        for (EmailCodeEnum codeEnum : codeEnums){
            if (codeEnum.value.equals(type)){
                return codeEnum;
            }
        }
        return UNKNOWN;
    }

}
